import cv2
import numpy as np

img = cv2.imread('chessboard.jpg', cv2.IMREAD_COLOR)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY).astype(np.float32)
# 检测到角点
dst = cv2.cornerHarris(gray, 2, 3, 0.04)
img[dst > 0.05 * dst.max()] = (0, 0, 255)
cv2.imshow('Harris Corner', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
